/* eslint-disable */
// @ts-nocheck
import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from 'vue-router'
import Layout from '../layout/index.vue'


const whiteList = ['/login', '/auth-redirect'] // no redirect whitelist

export const constantRoutes = [
    {
        path: '/intro',
        component: Layout,
        redirect: '/intro/index',
        children: [{
            path: 'index',
            name: 'intro',
            component: () =>
                import('../views/intro/index.vue'),
            meta: { title: '介绍', icon: 'star' },

        },]
    },

    {
        path: '/',
        component: Layout,
        redirect: '/dashboard',
        children: [{
            path: 'dashboard',
            name: 'Dashboard',
            component: () =>
                import('../views/home/index.vue'),
            meta: { title: 'Dashboard', icon: 'dashboard' ,affix :true
    }
        }]
    },

    {
        path: '/login',
        component: () => import('@/views/login/index.vue'),
        hidden: true,
    },




    {
        path: '/stock',
        component: Layout,
        redirect: '/stock/sz-a',
        name: 'Stock',
        meta: { title: '股市', icon: 'tree', },

        children: [{
            path: 'sz-a',
            name: 'sz-a',
            component: () =>
                import('../views/stock/sza.vue'),
            meta: { title: '深证公司', icon: 'chart' },

        },        {
            path: '/stockindex/index',
            component: () =>
            import('../views/stockindex/index.vue'),
        meta: { title: '深证指数', icon: 'chart' },

        },
         {
            path: 'sh-a',
            name: 'sh-a',
            component: () =>
                import('../views/stock/sha.vue'),
            meta: { title: '上证公司', icon: 'chart' }
        },

    ]
    },






    {
        path: '/video',
        component: Layout,
        redirect: '/video/index',

        children: [{
            path: 'index',
            name: 'video',
            component: () =>
                import('../views/video/index.vue'),
            meta: { title: '视频', icon: 'tab' },

        }]
    },

    {
        path: '/algorithm',
        component: Layout,
        redirect: '/algorithm/index',

        children: [{
            path: 'index',
            name: 'algorithm',
            component: () =>
                import('../views/algorithm/index.vue'),
            meta: { title: '算法', icon: 'tab' },

        }]
    },


    {
        path: '/404',
        component: () =>
            import('../views/error/404.vue'),
        hidden: true
    },
    // 404 page must be placed at the end !!!
    { path: '/:catchAll(.*)', redirect: '/404', hidden: true },

    {
        path: '/DxCorp',
        component: Layout,
        children: [
            {
                path: 'http://www.hsingdu.com',
                meta: { title: 'DxCorp', icon: 'link' }
            }
        ]
    },
]

// export const asyncRoutes = [
//     {
//         path: '/external-link',
//         component: Layout,
//         children: [
//             {
//                 path: 'http://www.hsingdu.com',
//                 meta: { title: 'External Link', icon: 'link' }
//             }
//         ]
//     },
// ]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    // history: createWebHashHistory(),
    routes: constantRoutes,
})

// const createCustomRouter = () => createRouter({
//     // mode: 'history', // require service support
//     history: createWebHistory(),
//     scrollBehavior: () => ({ y: 0 }),
//     routes: constantRoutes
//   });

// export function resetRouter() {
//     const newRouter = createCustomRouter()
//     router.matcher = newRouter.matcher // reset router
//   }



export default router